#include <stdio.h>

#define MAXL 10 //最大单词长度设置为10-1

int main()
{
    int c;
    int length;
    int num[MAXL];
    int i, j;
    int max;

    length = 0;
    max = 0;

    for (i = 0; i < MAXL; i++)
        num[i] = 0;

    // 统计各种长度的单词数目
    while ((c = getchar()) != EOF)
    {

        if (c == ' ' || c == '\t' || c == '\n')
        {
            if (length != 0)
                num[length]++;
            length = 0;
        }
        else
            length++;
    }

    // 打印测试
    for (i = 0; i < MAXL; i++)
        printf("num[%d]=%d\n", i, num[i]);

    for (i = 0; i < MAXL; i++)
        if (max < num[i])
            max = num[i];
    printf("\nvalue\n");

    // 打印直方图
    for (i = max; i > 0; i--)
    {
        printf("%2d", i);
        for (j = 0; j < MAXL; j++)
        {
            if (num[j] >= i)
                printf("%2c", '*');
            else
                printf("%2c", ' ');
        }
        printf("\n");
    }

    for (i = 0; i < MAXL; i++)
        printf("%2d", i);
    printf(" length\n");

    return 0;
}